package service

import "api/app/auth/models"

func CreateModelTree(root int, pages []*models.Model) []*models.Model {
	//获取底层
	roots := make([]*models.Model, 0)
	for _, page := range pages {
		if page.ParentId == root {
			roots = append(roots, page)
		}
	}
	for _, page := range roots {
		page.Children = CreateModelTree(page.Id, pages)
	}
	return roots
}
